Packages #23
reindert-vetter
started this conversation in
Docs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Create and share code across your projects
You can turn anything you build into a package and reuse it across all your projects. A package is just a collection of components, utilities, assets, and configuration that you can easily share and bring into other projects whenever you need them. It’s a bit like Git Submodules, but without the friction, and much more focused on how you actually work day to day.
Begin small
Just
run conf pkg:init your-organization/colorinside your project. This creates a package right in your codebase, without any external repository or versioning setup.Reuse across projects
Once your package starts to take shape, you can easily reuse it in other projects.
When you’re ready to share it, run
conf pkg:push your-organization/color. This pushes your package to a remote repository so it can be used elsewhere. From that point on, you can keep improving it and push updates whenever you make changes.In other projects, you can pull it in with
conf pkg:pull your-organization/color. That way, you always stay in sync without copying files or duplicating work.Get code from a specific project
Let’s keep it realistic: maintaining a separate repository for every small internal package isn’t always practical. Most of the time, packages grow naturally from project to project. With Confetti CMS, you can easily reuse code directly from another project. For example, you can pull a package straight from a project using:
conf pkg:pull your-organization/the-big-shop/pkg/your-organization/colorThis makes it easy to promote code from project to project as it matures, without needing to set up a dedicated repository upfront.
Keep your code isolated
Sometimes you want your package to behave like a small, self-contained service.
If you add a
Dockerfile, Confetti CMS will automatically build and run it for you. For example, thepkg/confetti-cms/image/container/Dockerfileruns a lightweight Go server that can store and modify images.With
Dockerfile.json5, you can configure how your package interacts with the rest of your project. In this example, uploaded files are shared with the web server, keeping everything connected without tight coupling (requested byview.Dockerfile.json5in the root of the project).Another example is the
website/tailwind.Dockerfilefile, which runs Tailwind in a development stage (FROM alpine:3.21 as development-cmd) and a production stage (FROM alpine:3.21 as production-cmd). You can configure multiple development and test environments by updating theconfig.json5file in the root of the project.Sell your package
Eventually, we will allow you to sell your package on a Confetti CMS marketplace. This way, you can monetize your code and assets by selling them to other developers. As a SaaS company, the buyer can’t see your code. Since AI can legally use a “clean room” approach to reverse engineer your code, it is necessary to protect your code more than ever.
Beta Was this translation helpful? Give feedback.
All reactions